package com.project.service.Impl;

import com.project.handlChain.HomeRichHandleChain;
import com.project.handlChain.TravelHandleChain;
import com.project.mapper.RiskControllerMapper;
import com.project.pojo.RiskController;
import com.project.service.TravelService;
import com.project.utils.ErrorMessage;
import com.project.vo.HomeMessage;
import com.project.vo.TripAccessVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class TravelServiceImpl implements TravelService {
    List<ErrorMessage> errorMessageList=new ArrayList<>();

    @Autowired
    TravelHandleChain travelHandleChain;

    @Autowired
    RiskControllerMapper riskControllerMapper;
    @Override
    public List<ErrorMessage> travelRiskControll(TripAccessVO tripAccessVO) {
        List<RiskController> risklist = riskControllerMapper.getByInsuranceTypeRiskControllers(3);
        travelHandleChain.handle(tripAccessVO,risklist,errorMessageList);
        if (errorMessageList.size()>0){
            return errorMessageList;
        }
        return  null;
    }

}
